import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';

class test_Getx_storage_controller extends GetxController {
  final box = GetStorage();
  var token = ''.obs;

  @override
  void onInit() {
    token.value = box.read('token') ?? '';
    super.onInit();
  }

  void login(String newToken) {
    token.value = newToken;
    box.write('token', newToken);
  }

  void logout() {
    token.value = '';
    box.remove('token');
  }
}
